<?php
declare (strict_types = 1);

namespace app\superAdmin\middleware;


class check
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        if(!preg_match('/login/',$request->pathinfo()) && !preg_match('/verify/',$request->pathinfo())){
            if(empty(session('user'))){
                return redirect((string)url('/superAdmin/login'));
            }
        }

        return $next($request);
    }
}
